package com.wandian.texas.command.texas;

import com.wandian.centerserver.CenterMgr;
import com.wandian.centerserver.CenterSessionMgr;
import com.wandian.command.Cmd;
import com.wandian.command.UserCommand;
import com.wandian.executor.TimerCommand;
import com.wandian.texas.BaseCommandObject;
import com.wandian.texas.GameMgr;

/**
 * @author long
 * @date 2012-12-10 下午3:17:16
 * @qq 108232706
 * @description CenterTimersCmd中心服务器定时器任务
 */
/**
 * @author long
 * @date 2012-12-10 下午3:26:31
 * @qq 108232706
 * @description CenterTimersCmd
 */
@Cmd(code = CenterSessionMgr.CMD_CENTER_SERVER_TIMERS, desc = "")
public class CenterTimersCmd extends UserCommand {
	/**
	 * 固定时间,未收到游戏端确认，回收积宝指标
	 */
	public static final byte RECYCLE_ALLOWCORNUCOPIA = 20;
	/**
	 * 定时去推送积宝,30秒更新一次，积宝起点,增长量
	 */
	public static final byte UPDATECORNUCOPIAPER30S = 21;
	/**
	 * 如，5分钟去同步全局数据,
	 */
	public static final byte SYNCORNUCOPIATODB = 22;
	/**
	 * 如5分钟去保存一次最新的积宝日志
	 */
	public static final byte INSERTCORNUCOPIARECORD = 23;
	/**
	 * 给游戏端使用，未发送的盈利同步
	 */
	public static final byte SYNNOTSENDMONEY = 24;

	public CenterTimersCmd() {
		this.setCommandName("CenterTimersCmd");
	}

	@Override
	public void execute(BaseCommandObject cmdObject) {
		super.execute(cmdObject);
		TimerCommand cmd = (TimerCommand) cmdObject;
		if (cmd == null)
			return;
		byte type = (Byte) cmd.get("Type");
		switch (type) {
		case RECYCLE_ALLOWCORNUCOPIA:
			CenterMgr.RECYCLE_ALLOWCORNUCOPIA(cmd);
			break;
		case UPDATECORNUCOPIAPER30S:
			CenterMgr.TimeToUpdateCornucopia(cmd);
			break;
		case SYNCORNUCOPIATODB:
			CenterMgr.synCornucopiaToDb();
			break;
		case INSERTCORNUCOPIARECORD:
			CenterMgr.insertCornucopiaRecord();
			break;
		//GameServer
		case SYNNOTSENDMONEY:
			GameMgr.SynNotSendMoney(cmd);
			break;
		default:
			break;
		}
	}

}
